package com.atguigu.ssyx.home.controller;

import com.atguigu.ssyx.client.product.ProductFeignClient;
import com.atguigu.ssyx.common.result.Result;
import com.atguigu.ssyx.model.product.Category;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * ClassName: CategoryController
 * Package: com.atguigu.ssyx.home.controller
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-10-03
 * Time: 12:26
 */

@Api(tags = "商品分类")
@RestController
@RequestMapping("/api/home")
public class CategoryController {

    //远程调用 接口 已经写好了
    @Autowired
    private ProductFeignClient productFeignClient;

    //查询所有分类
    @GetMapping("/category")
    public Result categoryList(){
        List<Category> allCategoryList = productFeignClient.findAllCategoryList();
        return Result.ok(allCategoryList);
    }

    //根据分类 查询商品分类里面商品的信息
    //这个接口写在了HomeApiController中 因为查询的是ES 可以远程调用实现
    //然后又从home中写到了search模块



}
